import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
//引入vant
import Vant from 'vant';
import 'vant/lib/index.css';
//轮播
import { Swipe, SwipeItem } from 'vant';

//拦截器+JWT
import axios from 'axios'
axios.defaults.baseURL = "http://localhost:24364";
axios.interceptors.request.use(config => {
  if (localStorage.getItem("token")) {
    config.headers.Authorization = "Bearer " + localStorage.getItem("token");
  }
  return config;
})

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(Vant);
// Lazyload 指令需要单独进行注册
// app.use(Vant.Lazyload);
app.use(Swipe);
app.use(SwipeItem);

app.use(ElementPlus, {
  locale: zhCn,
})

app.mount('#app')
